package com.zsc.boot.common;

import lombok.Data;

import java.io.Serializable;

/**
 *通用返回类
 * @param <T>
 */
@Data
public class BaseResponse<T> implements Serializable {
    private int code;

    private T data;

    private String msg;

    public BaseResponse(int code, T data, String msg) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

    public BaseResponse(int code, T data) {
        this.code = code;
        this.data = data;
        this.msg = "";
    }

    public BaseResponse(ErrorType errorType) {
        this.code = errorType.getCode();
        this.data = null;
        this.msg = errorType.getMsg();
    }



}
